<%@ page import="zjq.day0109.lottery.dao.UserDao" %>
<%@ page import="zjq.day0109.lottery.entity.User" %>
<%@ page import="java.util.List" %>
<%@ page import="zjq.day0109.lottery.dao.impl.UserDaoImpl" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="zjq.day0109.lottery.test.UserTest" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8" />
    <title>燃油汽车指标摇号系统</title>
    <link rel="stylesheet" href="../../../css/zjq/day0109/index.css" type="text/css">
    <script type="text/javascript" src="../../../js/zjq/day0109/jquery-3.6.3.js"></script>
<%--    <script type="text/javascript" src="../../../js/zjq/day0109/index.js"></script>--%>
<%--    <script type="text/javascript" src="../../../js/zjq/day0109/addUser.js"></script>--%>
    <%
        //jsp组成部分：jsp小脚本  内置对象（9个）  jsp指定
        /* 在jsp页面中获取后端java程序，进行数据交互 */
        //1.使用多态体现，创建实例化UserDao数据访问层
        UserDao userDao = new UserDaoImpl();
        //2.创建Map集合对象，用来存储查询列表的搜索条件参数
        Map<String,Object> map = new HashMap<>();
        //2.1 获取indexController.jsp中存储在request作用域中的searchName
        String searchName = request.getAttribute("searchName") == null ? "" : String.valueOf(request.getAttribute("searchName"));
        if (!"".equals(searchName)){
            map.put("markNo",searchName);
        }
        //3.调用查询数据列表方法
        List<User> userList = userDao.queryAllUser(map);

    %>

</head>

<body>
<div class="tittle">
    <strong>燃油汽车指标摇号系统</strong>
</div>

<div id="con">
    <form method="get" action="indexController.jsp">
    <button id="add" onclick="add();">添加</button>
    <input type="text" value="中签编码" id="check"  name="search">
    <button id ="select" onclick="javascript:window.location.href='indexController.jsp'">搜索</button>
    </form>
        <div id="A">
        <a href="index.html">参与摇号用户</a>
        <br>
        <a href="lottery.html">摇号</a>
    </div>
    <br>
    <br>

</div>
<div >
    <table id="table" class="last">
        <tr>
            <th>姓名</th>
            <th>中签编码</th>
            <th>持照状态</th>
            <th>手机号码</th>
            <th>开户日期</th>
            <th>操作</th>
        </tr>
        <%
            for (int i = 0; i < userList.size() ; i++) {

        %>
        <tr>
            <td><%=userList.get(i).getUsername()%></td>
            <td><%=userList.get(i).getMarkNo()%></td>
            <td><%=userList.get(i).getStatus()%></td>
            <td><%=userList.get(i).getPhone()%></td>
            <td><%=userList.get(i).getDate()%></td>
            <td></td>
        </tr>
        <% }%>
    </table>
</div>
</body>
</html>
